package mspbots.teams.client.config;

import io.minio.MinioClient;
import lombok.RequiredArgsConstructor;
import mspbots.teams.client.oauth.AuthProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * data.connector.teams.config.Minio
 *
 * @author Alex bob(https://github.com/vnobo)
 * @date Created by 2020/4/17
 */
@Configuration
@RequiredArgsConstructor
@EnableConfigurationProperties(AuthProperties.class)
public class MinioConfiguration {

    @Bean
    public MinioClient minioclient(AuthProperties authProperties) {
        return MinioClient.builder().endpoint(authProperties.getMinio().getEndpoint())
                .credentials(authProperties.getMinio().getAccessKey(),
                        authProperties.getMinio().getSecretKey()).build();
    }

}
